/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.merak.core.text;

import java.util.Date;
import java.util.Enumeration;
import java.util.Map;

import org.merak.core.text.base.DateTextifier;
import org.merak.core.text.base.JavaTextifier;
import org.merak.core.text.base.NullTextifier;
import org.merak.core.text.base.NumberTextifier;
import org.merak.core.text.base.StringTextifier;

/**
 * Copyright © 2010-2012 Merak Computing. All rights reserved.<br><br>
 *
 * Methods and declarations for TextifierSet.
 *
 * @author fmarinho.
 * @version 1.00.00 - Jul 20, 2012 - fmarinho - initial version.
 *
 * @since MerakCore 1.00.00
 */
public final class TextifierSet {

	//~ Constants //////////////////////////////////////////////////////////////////////////////////
	//**********************************************************************************************
	private static final Textifier<?> JAVA_TEXTIFIER = new JavaTextifier<Object>();

	//~ Attributes /////////////////////////////////////////////////////////////////////////////////
	//**********************************************************************************************
	private Textifier<?> nullTextifier       = new NullTextifier();
	private Textifier<?> objectTextifier     = JAVA_TEXTIFIER;

	private Textifier<?> stringTextifier     = new StringTextifier();
	private Textifier<?> numberTextifier     = new NumberTextifier();
	private Textifier<?> dateTextifier       = new DateTextifier();
	private Textifier<?> booleanTextifier    = JAVA_TEXTIFIER;
	private Textifier<?> characterTextifier  = JAVA_TEXTIFIER;
	private Textifier<?> enumTextifier       = JAVA_TEXTIFIER;

	private Textifier<?> arrayTextifier      = JAVA_TEXTIFIER;
	private Textifier<?> iterableTextifier   = JAVA_TEXTIFIER;
	private Textifier<?> mapTextifier        = JAVA_TEXTIFIER;
	private Textifier<?> enumerationTextifier= JAVA_TEXTIFIER;

	//~ Methods: Getters ///////////////////////////////////////////////////////////////////////////
	//**********************************************************************************************
	public Textifier<?> getNullTextifier() {
		return this.nullTextifier;
	}
	//**********************************************************************************************
	public Textifier<?> getObjectTextifier() {
		return this.objectTextifier;
	}
	//**********************************************************************************************
	public Textifier<?> getNumberTextifier() {
		return this.numberTextifier;
	}
	//**********************************************************************************************
	public Textifier<?> getStringTextifier() {
		return this.stringTextifier;
	}
	//**********************************************************************************************
	public Textifier<?> getCharacterTextifier() {
		return this.characterTextifier;
	}
	//**********************************************************************************************
	public Textifier<?> getDateTextifier() {
		return this.dateTextifier;
	}
	//**********************************************************************************************
	public Textifier<?> getBooleanTextifier() {
		return this.booleanTextifier;
	}
	//**********************************************************************************************
	public Textifier<?> getEnumTextifier() {
		return this.enumTextifier;
	}
	//**********************************************************************************************
	public Textifier<?> getArrayTextifier() {
		return this.arrayTextifier;
	}
	//**********************************************************************************************
	public Textifier<?> getIterableTextifier() {
		return this.iterableTextifier;
	}
	//**********************************************************************************************
	public Textifier<?> getMapTextifier() {
		return this.mapTextifier;
	}
	//**********************************************************************************************
	public Textifier<?> getEnumerationTextifier() {
		return this.enumerationTextifier;
	}
	//~ Methods: Setters ///////////////////////////////////////////////////////////////////////////
	//**********************************************************************************************
	public TextifierSet setNullTextifier(Textifier<?> textifier) {

		if (textifier!=null) this.nullTextifier = textifier;
		return this;

	}
	//**********************************************************************************************
	public TextifierSet setNumberTextifier(Textifier<Number> textifier) {

		if (textifier!=null) this.numberTextifier = textifier;
		return this;

	}
	//**********************************************************************************************
	public TextifierSet setStringTextifier(Textifier<CharSequence> textifier) {

		if (textifier!=null) this.stringTextifier= textifier;
		return this;

	}
	//**********************************************************************************************
	public TextifierSet setCharacterTextifier(Textifier<Character> textifier) {

		this.characterTextifier = textifier;
		return this;

	}
	//**********************************************************************************************
	public TextifierSet setDateTextifier(Textifier<Date> textifier) {

		if (textifier!=null) this.dateTextifier= textifier;
		return this;

	}
	//**********************************************************************************************
	public TextifierSet setBooleanTextifier(Textifier<Boolean> textifier) {

		if (textifier!=null) this.booleanTextifier= textifier;
		return this;

	}
	//**********************************************************************************************
	public TextifierSet setEnumTextifier(Textifier<Enum<?>> textifier) {

		if (textifier!=null) this.enumTextifier = textifier;
		return this;

	}
	//**********************************************************************************************
	public TextifierSet setObjectTextifier(Textifier<?> textifier) {

		if (textifier!=null) this.objectTextifier = new Wrapper(textifier);
		return this;

	}
	//**********************************************************************************************
	public TextifierSet setArrayTextifier(Textifier<Object[]> textifier) {

		if (textifier!=null) this.arrayTextifier = new Wrapper(textifier);
		return this;

	}
	//**********************************************************************************************
	public TextifierSet setIterableTextifier(Textifier<Iterable<?>> textifier) {

		if (textifier!=null) this.iterableTextifier = new Wrapper(textifier);
		return this;

	}
	//**********************************************************************************************
	public TextifierSet setMapTextifier(Textifier<Map<?,?>> textifier) {

		if (textifier!=null) this.mapTextifier = new Wrapper(textifier);
		return this;

	}
	//**********************************************************************************************
	public TextifierSet setEnumerationTextifier(Textifier<Enumeration<?>> textifier) {

		if (textifier!=null) this.enumerationTextifier = new Wrapper(textifier);
		return this;

	}
	//**********************************************************************************************
	@Override
	public Object clone() {

		TextifierSet other = new TextifierSet();

		other.nullTextifier       = this.nullTextifier;
		other.objectTextifier     = this.objectTextifier;

		other.numberTextifier     = this.numberTextifier;
		other.booleanTextifier    = this.booleanTextifier;
		other.stringTextifier     = this.stringTextifier;
		other.characterTextifier  = this.characterTextifier;
		other.enumTextifier       = this.enumTextifier;
		other.dateTextifier       = this.dateTextifier;

		other.arrayTextifier      = this.arrayTextifier;
		other.iterableTextifier   = this.arrayTextifier;
		other.mapTextifier        = this.mapTextifier;
		other.enumerationTextifier= this.enumerationTextifier;

		return other;

	}
	//**********************************************************************************************

}
